.class public Lcom/esfile/screen/recorder/media/encode/audio/a;
.super Les/o7;
.source "MediaAudioEncoder.java"


# instance fields
.field private D:I

.field private E:I

.field private F:Z

.field private G:Lcom/esfile/screen/recorder/media/util/a;

.field private H:Lcom/esfile/screen/recorder/media/encode/audio/AudioRecordTask;

.field private I:Lcom/esfile/screen/recorder/media/encode/audio/AudioRecordTask$c;


# direct methods
.method public constructor <init>(IIZ)V
    .locals 1

    .line 1
    invoke-direct {p0}, Les/o7;-><init>()V

    const v0, 0xac44

    .line 2
    iput v0, p0, Lcom/esfile/screen/recorder/media/encode/audio/a;->D:I

    const/4 v0, 0x1

    .line 3
    iput v0, p0, Lcom/esfile/screen/recorder/media/encode/audio/a;->E:I

    .line 4
    iput-boolean v0, p0, Lcom/esfile/screen/recorder/media/encode/audio/a;->F:Z

    const/4 v0, 0x0

    .line 5
    iput-object v0, p0, Lcom/esfile/screen/recorder/media/encode/audio/a;->G:Lcom/esfile/screen/recorder/media/util/a;

    .line 6
    iput-object v0, p0, Lcom/esfile/screen/recorder/media/encode/audio/a;->H:Lcom/esfile/screen/recorder/media/encode/audio/AudioRecordTask;

    .line 7
    new-instance v0, Lcom/esfile/screen/recorder/media/encode/audio/a$a;

    invoke-direct {v0, p0}, Lcom/esfile/screen/recorder/media/encode/audio/a$a;-><init>(Lcom/esfile/screen/recorder/media/encode/audio/a;)V

    iput-object v0, p0, Lcom/esfile/screen/recorder/media/encode/audio/a;->I:Lcom/esfile/screen/recorder/media/encode/audio/AudioRecordTask$c;

    if-lez p1, :cond_0

    .line 8
    iput p1, p0, Lcom/esfile/screen/recorder/media/encode/audio/a;->D:I

    :cond_0
    if-lez p2, :cond_1

    .line 9
    iput p2, p0, Lcom/esfile/screen/recorder/media/encode/audio/a;->E:I

    .line 10
    :cond_1
    iput-boolean p3, p0, Lcom/esfile/screen/recorder/media/encode/audio/a;->F:Z

    return-void
.end method

.method private D()Z
    .locals 4

    .line 1
    iget-object v0, p0, Lcom/esfile/screen/recorder/media/encode/audio/a;->H:Lcom/esfile/screen/recorder/media/encode/audio/AudioRecordTask;

    if-eqz v0, :cond_0

    .line 2
    invoke-virtual {v0}, Lcom/esfile/screen/recorder/media/encode/audio/AudioRecordTask;->f()V

    .line 3
    :cond_0
    iget-object v0, p0, Lcom/esfile/screen/recorder/media/encode/audio/a;->G:Lcom/esfile/screen/recorder/media/util/a;

    if-eqz v0, :cond_1

    .line 4
    new-instance v1, Lcom/esfile/screen/recorder/media/encode/audio/AudioRecordTask;

    iget-object v2, p0, Lcom/esfile/screen/recorder/media/encode/audio/a;->I:Lcom/esfile/screen/recorder/media/encode/audio/AudioRecordTask$c;

    invoke-direct {v1, v0, v2}, Lcom/esfile/screen/recorder/media/encode/audio/AudioRecordTask;-><init>(Lcom/esfile/screen/recorder/media/util/a;Lcom/esfile/screen/recorder/media/encode/audio/AudioRecordTask$c;)V

    iput-object v1, p0, Lcom/esfile/screen/recorder/media/encode/audio/a;->H:Lcom/esfile/screen/recorder/media/encode/audio/AudioRecordTask;

    goto :goto_0

    .line 5
    :cond_1
    new-instance v0, Lcom/esfile/screen/recorder/media/encode/audio/AudioRecordTask;

    iget v1, p0, Lcom/esfile/screen/recorder/media/encode/audio/a;->D:I

    iget v2, p0, Lcom/esfile/screen/recorder/media/encode/audio/a;->E:I

    iget-object v3, p0, Lcom/esfile/screen/recorder/media/encode/audio/a;->I:Lcom/esfile/screen/recorder/media/encode/audio/AudioRecordTask$c;

    invoke-direct {v0, v1, v2, v3}, Lcom/esfile/screen/recorder/media/encode/audio/AudioRecordTask;-><init>(IILcom/esfile/screen/recorder/media/encode/audio/AudioRecordTask$c;)V

    iput-object v0, p0, Lcom/esfile/screen/recorder/media/encode/audio/a;->H:Lcom/esfile/screen/recorder/media/encode/audio/AudioRecordTask;

    .line 6
    :goto_0
    iget-object v0, p0, Lcom/esfile/screen/recorder/media/encode/audio/a;->H:Lcom/esfile/screen/recorder/media/encode/audio/AudioRecordTask;

    invoke-virtual {v0}, Lcom/esfile/screen/recorder/media/encode/audio/AudioRecordTask;->d()Z

    move-result v0

    if-eqz v0, :cond_2

    .line 7
    iget-object v0, p0, Lcom/esfile/screen/recorder/media/encode/audio/a;->H:Lcom/esfile/screen/recorder/media/encode/audio/AudioRecordTask;

    invoke-virtual {v0}, Lcom/esfile/screen/recorder/media/encode/audio/AudioRecordTask;->b()I

    move-result v0

    iput v0, p0, Lcom/esfile/screen/recorder/media/encode/audio/a;->D:I

    .line 8
    iget-object v0, p0, Lcom/esfile/screen/recorder/media/encode/audio/a;->H:Lcom/esfile/screen/recorder/media/encode/audio/AudioRecordTask;

    invoke-virtual {v0}, Lcom/esfile/screen/recorder/media/encode/audio/AudioRecordTask;->a()I

    move-result v0

    iput v0, p0, Lcom/esfile/screen/recorder/media/encode/audio/a;->E:I

    const/4 v0, 0x1

    return v0

    :cond_2
    const/4 v0, 0x0

    return v0
.end method

.method static synthetic a(Lcom/esfile/screen/recorder/media/encode/audio/a;)J
    .locals 2

    .line 1
    iget-wide v0, p0, Les/o7;->r:J

    return-wide v0
.end method

.method static synthetic a(Lcom/esfile/screen/recorder/media/encode/audio/a;Ljava/lang/Exception;)V
    .locals 0

    .line 2
    invoke-virtual {p0, p1}, Les/o7;->b(Ljava/lang/Exception;)V

    return-void
.end method


# virtual methods
.method protected A()V
    .locals 1

    .line 1
    iget-object v0, p0, Lcom/esfile/screen/recorder/media/encode/audio/a;->H:Lcom/esfile/screen/recorder/media/encode/audio/AudioRecordTask;

    if-eqz v0, :cond_0

    .line 2
    invoke-virtual {v0}, Lcom/esfile/screen/recorder/media/encode/audio/AudioRecordTask;->h()V

    :cond_0
    return-void
.end method

.method protected B()Z
    .locals 7

    const-string v0, "audio/mp4a-latm"

    const-string v1, "MediaAudioEncoder"

    const-string v2, "prepare:"

    .line 1
    invoke-static {v1, v2}, Lcom/esfile/screen/recorder/media/util/k;->c(Ljava/lang/String;Ljava/lang/String;)V

    const/4 v2, 0x0

    .line 2
    iput-boolean v2, p0, Les/o7;->i:Z

    .line 3
    iput-boolean v2, p0, Les/o7;->j:Z

    .line 4
    :try_start_0
    iget-boolean v3, p0, Lcom/esfile/screen/recorder/media/encode/audio/a;->F:Z

    if-eqz v3, :cond_0

    .line 5
    invoke-direct {p0}, Lcom/esfile/screen/recorder/media/encode/audio/a;->D()Z

    move-result v3

    if-nez v3, :cond_0

    const-string v0, "Prepare AudioRecorder failed"

    .line 6
    invoke-static {v1, v0}, Lcom/esfile/screen/recorder/media/util/k;->a(Ljava/lang/String;Ljava/lang/String;)V

    return v2

    :cond_0
    const/4 v3, 0x1

    .line 7
    invoke-static {v0, v3}, Lcom/esfile/screen/recorder/media/util/u;->a(Ljava/lang/String;Z)Landroid/media/MediaCodecInfo;

    move-result-object v4

    if-nez v4, :cond_1

    const-string v0, "Unable to find an appropriate codec for audio/mp4a-latm"

    .line 8
    invoke-static {v1, v0}, Lcom/esfile/screen/recorder/media/util/k;->a(Ljava/lang/String;Ljava/lang/String;)V

    return v2

    .line 9
    :cond_1
    new-instance v5, Ljava/lang/StringBuilder;

    invoke-direct {v5}, Ljava/lang/StringBuilder;-><init>()V

    const-string v6, "selected codec: "

    invoke-virtual {v5, v6}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v4}, Landroid/media/MediaCodecInfo;->getName()Ljava/lang/String;

    move-result-object v4

    invoke-virtual {v5, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v5}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v4

    invoke-static {v1, v4}, Lcom/esfile/screen/recorder/media/util/k;->c(Ljava/lang/String;Ljava/lang/String;)V

    .line 10
    iget v4, p0, Lcom/esfile/screen/recorder/media/encode/audio/a;->D:I

    iget v5, p0, Lcom/esfile/screen/recorder/media/encode/audio/a;->E:I

    invoke-static {v0, v4, v5}, Landroid/media/MediaFormat;->createAudioFormat(Ljava/lang/String;II)Landroid/media/MediaFormat;

    move-result-object v4

    iput-object v4, p0, Les/o7;->l:Landroid/media/MediaFormat;

    const-string v5, "aac-profile"

    const/4 v6, 0x2

    .line 11
    invoke-virtual {v4, v5, v6}, Landroid/media/MediaFormat;->setInteger(Ljava/lang/String;I)V

    .line 12
    iget-object v4, p0, Les/o7;->l:Landroid/media/MediaFormat;

    const-string v5, "channel-mask"

    iget v6, p0, Lcom/esfile/screen/recorder/media/encode/audio/a;->E:I

    if-ne v6, v3, :cond_2

    const/16 v6, 0x10

    goto :goto_0

    :cond_2
    const/16 v6, 0xc

    :goto_0
    invoke-virtual {v4, v5, v6}, Landroid/media/MediaFormat;->setInteger(Ljava/lang/String;I)V

    .line 13
    iget-object v4, p0, Les/o7;->l:Landroid/media/MediaFormat;

    const-string v5, "bitrate"

    const v6, 0x1f400

    invoke-virtual {v4, v5, v6}, Landroid/media/MediaFormat;->setInteger(Ljava/lang/String;I)V

    .line 14
    new-instance v4, Ljava/lang/StringBuilder;

    invoke-direct {v4}, Ljava/lang/StringBuilder;-><init>()V

    const-string v5, "format: "

    invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    iget-object v5, p0, Les/o7;->l:Landroid/media/MediaFormat;

    invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    invoke-virtual {v4}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v4

    invoke-static {v1, v4}, Lcom/esfile/screen/recorder/media/util/k;->c(Ljava/lang/String;Ljava/lang/String;)V

    .line 15
    invoke-static {v0}, Lcom/esfile/screen/recorder/media/util/n;->c(Ljava/lang/String;)Lcom/esfile/screen/recorder/media/util/n;

    move-result-object v0

    iput-object v0, p0, Les/o7;->k:Lcom/esfile/screen/recorder/media/util/n;

    .line 16
    iget-object v4, p0, Les/o7;->l:Landroid/media/MediaFormat;

    const/4 v5, 0x0

    invoke-virtual {v0, v4, v5, v5, v3}, Lcom/esfile/screen/recorder/media/util/n;->a(Landroid/media/MediaFormat;Landroid/view/Surface;Landroid/media/MediaCrypto;I)V

    .line 17
    iget-object v0, p0, Les/o7;->k:Lcom/esfile/screen/recorder/media/util/n;

    invoke-virtual {v0}, Lcom/esfile/screen/recorder/media/util/n;->j()V

    const-string v0, "prepare finishing"

    .line 18
    invoke-static {v1, v0}, Lcom/esfile/screen/recorder/media/util/k;->c(Ljava/lang/String;Ljava/lang/String;)V
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    return v3

    :catch_0
    move-exception v0

    .line 19
    invoke-virtual {v0}, Ljava/lang/Exception;->printStackTrace()V

    const-string v0, "prepare error!"

    .line 20
    invoke-static {v1, v0}, Lcom/esfile/screen/recorder/media/util/k;->c(Ljava/lang/String;Ljava/lang/String;)V

    return v2
.end method

.method protected a(ILjava/nio/ByteBuffer;Landroid/media/MediaCodec$BufferInfo;)V
    .locals 0

    .line 3
    invoke-super {p0, p1, p2, p3}, Les/o7;->a(ILjava/nio/ByteBuffer;Landroid/media/MediaCodec$BufferInfo;)V

    return-void
.end method

.method public b()I
    .locals 1

    .line 1
    iget v0, p0, Lcom/esfile/screen/recorder/media/encode/audio/a;->E:I

    return v0
.end method

.method protected c(Landroid/media/MediaFormat;)V
    .locals 3

    .line 1
    iget-object v0, p0, Lcom/esfile/screen/recorder/media/encode/audio/a;->H:Lcom/esfile/screen/recorder/media/encode/audio/AudioRecordTask;

    if-eqz v0, :cond_0

    if-eqz p1, :cond_0

    const/4 v1, -0x1

    const-string v2, "max-input-size"

    .line 2
    invoke-static {p1, v2, v1}, Lcom/esfile/screen/recorder/media/util/s;->a(Landroid/media/MediaFormat;Ljava/lang/String;I)I

    move-result p1

    invoke-virtual {v0, p1}, Lcom/esfile/screen/recorder/media/encode/audio/AudioRecordTask;->a(I)V

    :cond_0
    return-void
.end method

.method public e()I
    .locals 1

    .line 1
    iget v0, p0, Lcom/esfile/screen/recorder/media/encode/audio/a;->D:I

    return v0
.end method

.method public h()Z
    .locals 1

    const/4 v0, 0x1

    return v0
.end method

.method protected l()V
    .locals 1

    .line 1
    invoke-super {p0}, Les/o7;->l()V

    .line 2
    iget-object v0, p0, Lcom/esfile/screen/recorder/media/encode/audio/a;->G:Lcom/esfile/screen/recorder/media/util/a;

    if-eqz v0, :cond_0

    .line 3
    invoke-virtual {v0}, Lcom/esfile/screen/recorder/media/util/a;->f()V

    :cond_0
    return-void
.end method

.method protected w()V
    .locals 1

    .line 1
    iget-object v0, p0, Lcom/esfile/screen/recorder/media/encode/audio/a;->H:Lcom/esfile/screen/recorder/media/encode/audio/AudioRecordTask;

    if-eqz v0, :cond_0

    .line 2
    invoke-virtual {v0}, Lcom/esfile/screen/recorder/media/encode/audio/AudioRecordTask;->c()V

    :cond_0
    return-void
.end method

.method protected x()V
    .locals 1

    .line 1
    iget-object v0, p0, Lcom/esfile/screen/recorder/media/encode/audio/a;->H:Lcom/esfile/screen/recorder/media/encode/audio/AudioRecordTask;

    if-eqz v0, :cond_0

    .line 2
    invoke-virtual {v0}, Lcom/esfile/screen/recorder/media/encode/audio/AudioRecordTask;->e()V

    :cond_0
    return-void
.end method

.method protected y()V
    .locals 1

    .line 1
    iget-object v0, p0, Lcom/esfile/screen/recorder/media/encode/audio/a;->H:Lcom/esfile/screen/recorder/media/encode/audio/AudioRecordTask;

    if-eqz v0, :cond_0

    .line 2
    invoke-virtual {v0}, Lcom/esfile/screen/recorder/media/encode/audio/AudioRecordTask;->f()V

    :cond_0
    return-void
.end method

.method protected z()V
    .locals 1

    .line 1
    iget-object v0, p0, Lcom/esfile/screen/recorder/media/encode/audio/a;->H:Lcom/esfile/screen/recorder/media/encode/audio/AudioRecordTask;

    if-eqz v0, :cond_0

    .line 2
    invoke-virtual {v0}, Lcom/esfile/screen/recorder/media/encode/audio/AudioRecordTask;->g()V

    :cond_0
    return-void
.end method
